<h1>Editing city</h1>

<% form_for(@city) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </p>
    <p>
      <%= f.label :country %><br />
      <%= select_tag :country_filter, options_from_collection_for_select( @countries, :id, :name, @city_country_id) %>
      
      <%= observe_field :country_filter,
                        :update    => 'city_states',
                        :url       => {:controller =>'cities', :action=>'get_country_states', :only_path => false},
                        :with      => "['country_id=' +value]" %>
    </p>

    <p id="city_states">
        <%= render :partial=>'update_states' %>
    </p>
    
  <p>
    <%= f.submit 'Update' %>
  </p>
<% end %>

<%= link_to 'Show', @city %> |
<%= link_to 'Back', cities_path %>